import com.beans.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        //1、获取 Spring 的 上下文对象
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //2、根据上下文独享提供的方法，来获取对应的 bean
//        UserController userController = context.getBean("UserController",UserController.class);
//        UserService userService = context.getBean("userService", UserService.class);
//        UserRepository userRepository = context.getBean("userRepository", UserRepository.class);
//        UserConfiguration userConfiguration = context.getBean("userConfiguration", UserConfiguration.class);
//        UserComponent userComponent = context.getBean("userComponent",UserComponent.class);
        APIController apiController = context.getBean("APIController",APIController.class);
        // 是一个 bean 里面的方法
//        userController.sayHi();
//        userService.sayHi();
//        userRepository.sayHi();
//        userConfiguration.sayHi();
//        userComponent.sayHi();
        apiController.sayHi();
    }
}
